﻿using System.Collections.Generic;
using System.ServiceModel;
using Pku.BookStore.Model;

namespace Pku.BookStore.IServices
{
    [ServiceContract(Name = "ICategoryServices", Namespace = "Pku.BookStore.IServices")]
    public interface ICategoryServices
    {
        /// <summary>
        /// 增加分类
        /// </summary>
        /// <param name="entity"></param>
        [OperationContract(Name = "Add")]
        int Add(CategoryModel entity);

        /// <summary>
        /// 修改分类
        /// </summary>
        /// <param name="entity"></param>
        [OperationContract(Name = "Modify")]
        bool Modify(CategoryModel entity);

        /// <summary>
        /// 搜索
        /// </summary>
        /// <returns></returns>
        [OperationContract(Name = "Search")]
        List<CategoryModel> Search(Model.CategoryParam param);

        /// <summary>
        /// 获取实体
        /// </summary>
        /// <param name="categoryID"></param>
        /// <returns></returns>
        [OperationContract(Name = "GetEntityById")]
        CategoryModel GetEntityById(int categoryID);

        /// <summary>
        /// 是否存在
        /// </summary>
        /// <param name="Str">关键字</param>
        /// <returns></returns>
        [OperationContract(Name = "Exist")]
        bool Exist(string Str);

        /// <summary>
        /// 获取总数
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [OperationContract(Name = "GetCount")]
        int GetCount(Model.CategoryParam param);

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="CategoryID"></param>
        /// <returns></returns>
        [OperationContract(Name = "Delete")]
        bool Delete(int CategoryID);

        /// <summary>
        /// 取同级分类
        /// </summary>
        /// <param name="Level"></param>
        /// <param name="pCatid"></param>
        /// <returns></returns>
        [OperationContract(Name = "GetLevelSame")]
        List<CategoryModel> GetLevelSame(int Level, int pCatid);

    }
}
